/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package generics_and_collections;

import java.util.*;

/**
 *
 * @author arif
 */
public class SampleListSetDeque {

    public static void sampleList() {
        List<String> tempList = new ArrayList<>();
        tempList.add("str-1");
        tempList.add(1, "str-2");
        tempList.add("str-3");
        tempList.add(3, "str-4");

        System.out.println("all of object : " + tempList);
        System.out.println("is list contain of str-1 : " + tempList.contains("str-1"));
        System.out.println("object at index 1 : " + tempList.get(1)); 
    }

    public static void sampleSet() {
        Set<String> tempSet = new HashSet<>();
        tempSet.add("set-1");
        tempSet.add("set-2");
        tempSet.add("set-3");

        System.out.println("before remove set-2 : " + tempSet);
        tempSet.remove("set-2");
        System.out.println("after remove set-2 : " + tempSet);
    }

    public static void sampleDeque() {
        Deque tempDeque = new LinkedList();
        tempDeque.add("deq-1");
        tempDeque.add("deq-2");
        System.out.println("before add first : " + tempDeque);
        tempDeque.addFirst("deq-0");
        System.out.println("after add first : " + tempDeque);
        tempDeque.addLast("deq-3");
        System.out.println("after add last : " + tempDeque);
    }

    public static void main(String args[]) {
        sampleList();        
//        sampleSet();
//        sampleDeque();
    }
}
